<div ng-controller="CustomformCtrl" ng-init="typelistAction()">
    <ul class="sui-breadcrumb">
        <li><a href="#/customform/list">{{custom_form.form_name| translate}}</a></li>
        <li class="active">
            {{"List"|translate}}
        </li>
        <span class="sui-form sui-form pull-right">
        </span>
    </ul>
    <table class="sui-table table-bordered">
        <thead>
            <tr>
                <th>{{'选项名称'|translate}}</th>
                <th>{{'选项说明'|translate}}</th>
                <th>{{'选项类型'|translate}}</th>
                <th width="30%">{{'默认值'|translate}}</th>
                <th width="15%">{{'表单选项'|translate}}</th>
                <th>{{'排列顺序'|translate}}</th>
                <th>{{'是否必填'|translate}}</th>
                <th>{{'是否启用'|translate}}</th>
                <th>{{'卖家填写字段'|translate}}</th>
                <th>{{'operation'|translate}}</th>

            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="list in customform_type_list">
                <td>{{list.title}}</td>
                <td>{{list.title_msg}}</td>
                <td>{{list.type}}</td>
                <td>{{list.default_value}}</td>
                <td>{{list.options}}</td>
                <td>{{list.sort}}</td>
                <td>{{list.is_must == 1?"是":"否"}}</td>
                <td>{{list.display == 1?"是":"否"}}</td>
                <td>{{list.status == 1?"否":"是"}}</td>
                <td>
                    <a href="#/customform/typeadd?type_id={{list.type_id}}"
                        class="sui-btn btn-primary">{{'edit'|translate}}</a>
                </td>
            </tr>
        </tbody>
    </table>
    <pager page-no="1" page-size="pageSize" total="total_count" get-data="getCustomFormTypeList(pageNo)"></pager>

    <!-- 选项添加 -->
    <table class="sui-table table-bordered">
        <thead>
            <th>增加字段</th>
        </thead>
    </table>
    <form name="customTypeForm" novalidate class="sui-form form-horizontal">
        <div class="control-group">
            <label class="control-label v-top">{{'选项名称' | translate}}:</label>
            <div class="controls">
                <input id="title" type="text" name="title" ng-model="form_type.title" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top">{{'选项说明' | translate}}:</label>
            <div class="controls">
                <textarea rows="3" ng-model="form_type.title_msg" class="input-xlarge"></textarea>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top">{{'选项类型'|translate}}:</label>
            <div class="controls">
                <label>
                    <select ng-model="form_type.type"
                        ng-options="types.type as types.name for types in form_types"></select>
                </label>
            </div>
        </div>
        <div class="control-group"
            ng-show="form_type.type=='select' || form_type.type == 'checkbox' || form_type.type == 'radio'">
            <label class="control-label v-top">{{'表单选项' | translate}}:</label>
            <div class="controls">
                <table class="sui-table table-bordered" ng-show="form_type.options">
                    <thead>
                        <tr>
                            <th>选项名称</th>
                            <th>选项值</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="option in form_type.options track by $index">
                            <td>
                                <input type="text" class="input-medium" ng-model="option.option_name">
                            </td>
                            <td>
                                <input type="text" class="input-medium" ng-model="option.option_value">
                            </td>
                            <td>
                                <button class="sui-btn btn-primary" ng-click="delOption($index)">删除</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <button class="sui-btn btn-primary" ng-click="addOptions();">+增加选项</button>
            </div>
        </div>
        <div ng-show="form_type.type != 'hide'">
            <div class="control-group" ng-show="form_type.type !='remark'">
                <label class="control-label v-top">{{'默认值' | translate}}:</label>
                <div class="controls">
                    <textarea rows="3" ng-model="form_type.default_value" class="input-xlarge"></textarea>
                </div>
            </div>
        </div>
        <div class="control-group" ng-show="form_type.type=='remark' || form_type.type=='hide'">
            <label class="control-label v-top">
                {{'默认值' | translate}}:
            </label>
            <div class="controls">
                <ueditor ng-model="form_type.default_value1" uid="beizhuintroduce" style="width:694px"></ueditor>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label v-top">{{'排列顺序' | translate}}:</label>
            <div class="controls">
                <input id="sort" type="text" name="sort" ng-model="form_type.sort" />
                <div class="sui-msg msg-success msg-clear help-block">
                    <div class="msg-con">排列数字，数字越大，排序越靠后</div>
                    <s class="msg-icon"></s>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label v-top">是否必填:</label>
            <div class="controls">
                <label>
                    <input type="radio" name="ismust" ng-model="form_type.is_must" ng-value="1" class="input-xlarge"
                        required />是 </label>
                </label>
                <label>
                    <input type="radio" name="ismust" ng-model="form_type.is_must" ng-value="0" class="input-xlarge"
                        required />否 </label>
                </label>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label v-top">卖家填写字段:</label>
            <div class="controls">
                <label>
                    <input type="radio" name="status" ng-model="form_type.status" ng-value="2" class="input-xlarge"
                        required />是 </label>
                </label>
                <label>
                    <input type="radio" name="status" ng-model="form_type.status" ng-value="1" class="input-xlarge"
                        required />否 </label>
                </label>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label"></label>
            <div class="controls">
                <button type="submit" id="submit" class="sui-btn btn-primary"
                    ng-disabled="!custom_form.form_name || !custom_form.form_msg" ng-click="customformTypeAdd()">
                    <span>{{'save'|translate}}</span>
                </button>
            </div>
        </div>
    </form>
</div>